setTimeout(() => {
    console.log("A");
}, 3000);
console.log("B");


var p=new Promise((resolve,reject)=>{
    setTimeout(() => {
        console.log("A");
        resolve();
    }, 3000);
})
p.then(()=>{
    console.log("B");
})

function CreatePromiseForAjax(url){
    var p=new Promise((resolve,reject)=>{
        var xhr=new XMLHttpRequest();
        xhr.open("get",url);
        xhr.send();
        xhr.onreadystatechange=function(){
            if(xhr.readyState==4&&xhr.status==200){
                //获取到数据
                resolve(xhr.responseText)
            }else{
                reject("error")
            }
        }
    })
    return p;
}

CreatePromiseForAjax("url-a")
.then((data_a)=>{
   return  CreatePromiseForAjax("url-b");
})
.then((data_b)=>{
    return CreatePromiseForAjax("url-c");
})
.then((data_c)=>{

})

